<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/page.css" rel="stylesheet">
    <script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
</head>

<script>
    //删除url
    var deleteUrl = "{:url('dispatch/delete')}";
    var url = "/{$Request.module}/dispatch";
    var sortUrl = "{:url('dispatch/order')}";
    var enableUrl = "{:url('dispatch/enable')}";
</script>

<body class="gray-bg">
<div class="wrapper wrapper-content" id="server">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>配送方式列表</h5>
                </div>
                <div class="ibox-content">
                    <div class="row">
                        <div class="col-sm-7 m-b-xs">
                            <a href="{:url('dispatch/add')}"><button type="button" class="btn btn-sm btn-primary" id="add" style="margin-right:15px;"><i class="fa fa-plus" style="color:#FFF;"></i> 添加配送方式</button></a>
                            <button type="button" class="btn btn-sm btn-success" style="margin-right:15px;" id="order">更新排序</button>
                            <button type="button" class="btn btn-sm btn-default" onclick="enable(1)" style="margin-right:15px;"><i class="fa fa-check-circle-o" style="color:#FFF;"></i> 启用</button>
                            <button type="button" class="btn btn-sm btn-default" onclick="enable(0)" style="margin-right:15px;"><i class="fa fa-ban" style="color:#FFF;"></i> 禁用</button>
                            <button type="button" class="btn btn-sm btn-default" id="del" style="margin-right:15px;"><i class="fa fa-trash" style="color:#FFF;"></i> 删除</button>
                        </div>

                        <form action="{:url('dispatch/search')}" method="post" id="form_search">
                            <div class="col-sm-3" style="float:right;">
                                <div class="input-group">
                                    <input type="text" name="keyword" placeholder="请输入配送方式名称" {notempty name="dispatch_name"}value="{$dispatch_name}"{/notempty} class="input-sm form-control"><span class="input-group-btn">
                                    <button type="submit" class="btn btn-sm btn-primary" id="submit_search">搜索</button></span>
                                </div>
                            </div>
                        </form>
                    </div>

                    <div id="ajaxpagetest">
                        {include file="dispatch/ajaxpage" /}
                    </div>

                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/plugins/layer/layer.min.js"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/plugins/validate/jquery.validate.min.js"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<script src="__PUBLIC__/admin/js/common/admin.js"></script>
<script src="__PUBLIC__/admin/js/common/ajax.js"></script>
<script>
    function enable(i){
        var id_array=new Array();
        $('input[class=text_id]:checked').each(function(i,o){
            id_array.push($(o).val());//向数组中添加元素
        });
        var idstr=id_array.join(',');//将数组元素连接起来以构建一个字符串
        post(enableUrl,'POST',{'id':idstr,'enable':i},1);
    }

</script>
</body>
</html>